package mock_or_enum;

public class 你完成的完整对局数_1904 {
    public int numberOfRounds(String startTime, String finishTime) {
        String[] st = startTime.split(":");
        String[] ft = finishTime.split(":");
        int stHour = Integer.parseInt(st[0]);
        int stMin = Integer.parseInt(st[1]);
        int ftHour = Integer.parseInt(ft[0]);
        int ftMin = Integer.parseInt(ft[1]);
        int i = stMin / 15;
        int stMinQuarter = stMin % 15 == 0 ? i : i + 1;// 12:01 从12：15开始算  12：00从12：00开始算
        // 通宵了
        if (stHour > ftHour || (stHour == ftHour && stMin > ftMin)) {
            ftHour += 24;
        }
        if (ftHour > stHour) {
            return (ftHour - stHour - 1) * 4 + (60 - stMin) / 15 + ftMin / 15;
        }

        if (stMin % 15 == 0) {
            return ftMin / 15 - stMin / 15;
        }

        int times = ftMin / 15 - stMin / 15;
        System.out.println(times);
        return times >= 1 ? times - 1 : times; // 起始时间非15整数倍 需要后移到整数倍开始

    }
}
